<template>
    <a-date-picker
            :valueFormat="valueFormat"
            :disabledDate="disabledDate"
            :showTime="showTime"
            v-model="value"
            @change="onChange"
    />
</template>

<script>
    export default {
        name: 'BaseDatePicker',
        props: {
            disabledDate: {
                default: null
            },
            valueFormat: {
                default: 'YYYY-MM-DD'
            },
            showTime: {
                type: [Object, Boolean],
                default: false
            },
            val: {
                default: ''
            }
        },
        created() {
            this.value = this.val;
        },
        methods: {
            reset() {
                this.value = "";
                this.$forceUpdate();
            },
            onChange(date) {
                this.value = date;
                this.$forceUpdate();
                this.$emit('onDateChange', date)
            }
        }
    }
</script>

<style scoped>

</style>
